/*
 * Copyright (c) 2014 pkzd/1.0, 颜文泽(robin)
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *     1 Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     2 Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef MC_INO_H
#define MC_INO_H

#include	<types.h>

#define NADDR	13
#define NIOPB	12
#define ROOTINO	1
#define S_IFMT  00170000
        #define S_IFLNK 0120000      
        #define S_IFREG 0100000       
        #define S_IFBLK 0060000        
        #define S_IFDIR 0040000        
        #define S_IFCHR 0020000    
		#define S_ISLNK(m)      (((m) & S_IFMT) == S_IFLNK)
		#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
		#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
		#define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)
		#define S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)
#define S_ISUID 0004000                
#define S_ISGID 0002000                
#define S_IRWXU 0000700                
        #define S_IRUSR 0000400                
        #define S_IWUSR 0000200                
        #define S_IXUSR 0000100               
		#define S_ISRU(m)	(((m) & S_IRWXU) == S_IRUSR)
		#define S_ISWU(m)	(((m) & S_IRWXU) == S_IWUSR) 
		#define S_ISXU(m)	(((m) & S_IRWXU) == S_IXUSR)
#define S_IRWXG 0000070               
        #define S_IRGRP 0000040               
        #define S_IWGRP 0000020                
        #define S_IXGRP 0000010               
		#define S_ISRG(m)	(((m) & S_IRWXG) == S_IRGRP)
		#define S_ISWG(m)	(((m) & S_IRWXG) == S_IWGRP) 
		#define S_ISXG(m)	(((m) & S_IRWXG) == S_IXGRP)
#define S_IRWXO 0000007                 
        #define S_IROTH 0000004                 
        #define S_IWOTH 0000002               
        #define S_IXOTH 0000001            
		#define S_ISRO(m)	(((m) & S_IRWXO) == S_IROTH)
		#define S_ISWO(m)	(((m) & S_IRWXO) == S_IWOTH) 
		#define S_ISXO(m)	(((m) & S_IRWXO) == S_IXOTH)

struct inode{
	mode_t	i_mode;
	nlink_t	i_nlink;
	uid_t	i_uid;
	gid_t	i_gid;
	off_t	i_size;
	time_t	i_atime;
	time_t	i_mtime;
	time_t	i_ctime;
	addr_t	i_addr[NADDR];
};

#endif
